﻿namespace Digitalmes.Application.Common.Models;

/// <summary>
/// API 接口返回结果。
/// </summary>
/// <remarks>
/// 数据格式为：
/// {
///     "code": 200,
///     "success": true,
///     "message": "",
///     "data": { }
/// }
/// <para>状态码 200 表示 OK。</para>
/// </remarks>
public interface IApiResult
{
    /// <summary>
    /// 状态码
    /// </summary>
    int Code { get; }

    /// <summary>
    /// 消息
    /// </summary>
    [NotNull]
    string? Message { get; }

    /// <summary>
    /// 数据
    /// </summary>
    object? Data { get; }
}

/// <summary>
/// API 接口返回结果。
/// </summary>
/// <remarks>
/// 数据格式为：
/// {
///     "code": 200,
///     "success": true,
///     "message": "",
///     "data": { }
/// }
/// <para>状态码 200 表示 OK。</para>
/// </remarks>
public interface IApiResult<TData> : IApiResult
{
    /// <summary>
    /// 数据
    /// </summary>
    new TData? Data { get; }
}
